<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/common/taglibs.jsp"%>
<!DOCTYPE html>
<html class="ng-app:myApp" id="ng-app" ng-app="myApp" xmlns:ng="http://angularjs.org">
<head>
<title>客户管理</title>
<%@ include file="/WEB-INF/common/meta.jsp"%>
<%@ include file="/WEB-INF/layouts/global_res_header.jsp"%>
</head>

<body ng-controller="clientCtrl">
	<div id="mainDataBlock" ng-grid="gridOptions"></div>
	<div id="funcBlock" class="alert alert-info">
		<div class="btn-group btn-group-sm">
			<button type="button" class="btn btn-default" ng-click="onOpenQueryFormModal()">
				<span class="glyphicon glyphicon-search"></span> 查询
			</button>
			<button type="button" class="btn btn-default" ng-click="refresh()"  id="bt">
				<span class="glyphicon glyphicon-refresh"></span> 刷新
			</button>
			<shiro:hasPermission name="sys:client:import">
			<button type="button" class="btn btn-default" ng-click="onOpenImportFormModal()">
				<span class="glyphicon glyphicon-import"></span> 导入
			</button>
			</shiro:hasPermission>
			<shiro:hasPermission name="sys:client:export">
			<button type="button" class="btn btn-default" ng-click="onOpenExportFormModal()">
				<span class="glyphicon glyphicon-export"></span> 导出
			</button>
			</shiro:hasPermission>
		</div>
	</div>
</body>

<div id="queryFormModal" class="modal" tabindex="-1" data-width="400px">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h4 class="modal-title">查询</h4>
	</div>
	<div class="modal-body">
		<div class="row">
			<div class="col-md-12">
				<form name="queryFormForm" class="form-inline" role="form">
					<div class="form-group">
						<label for="cd">代码</label> 
						<input  name="cd" ng-model="queryForm.cd" class="form-control" placeholder="代码">		
					</div>
					<div class="form-group">
						<label for="name">名称</label> 
						<input  name="name" ng-model="queryForm.name" class="form-control" placeholder="名称">		
					</div>
					<div class="form-group top">
						<label for="shortName">缩写</label> 
						<input  name="shortName" ng-model="queryForm.shortName" class="form-control" placeholder="名称">		
					</div>		
					<div class="form-group top">
						<label for="st">状态</label>
						<select name="st" ui-select2="{width:'150px', allowClear:'true'}" ng-model="queryForm.st" class="select2" data-placeholder="状态">
							<option value=""></option>
							<option ng-repeat="st in stList" value="{{st.id}}">{{st.lb}}</option>
						</select>
					</div>
				</form>
			</div>
		</div>
	</div>
	<div class="modal-footer">
		<button type="button" data-dismiss="modal" class="btn btn-default">关闭</button>
		<button ng-click="onQuery()" ng-disabled="queryFormForm.$invalid" class="btn btn-default">查询</button>
	</div>
</div>

<div id="editFormModal" class="modal" tabindex="-1" data-width="900px">
	<div class="modal-header" id="jd_dialog_m_h">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h4 class="modal-title">客户管理</h4>
	</div>
	<div class="modal-body">
		<div class="row">
			<div class="col-md-12">
				<form name="editFormForm" role="form" novalidate>
					<input type="hidden" name="id" ng-model="editForm.id"
						class="form-control">
					<div class="row">
						<div class="col-sm-4">	
							&nbsp;&nbsp;<span class="spancss">*</span>代码： <input name="cd" ng-model="editForm.cd" required class="form-control" placeholder="标识">
						</div>
						<div class="col-sm-4">
							&nbsp;&nbsp;<span class="spancss">*</span>名称： <input name="name" ng-model="editForm.name" required class="form-control" placeholder="名称">
						</div>					
						<div class="col-sm-4">					
							<span class="spancss">*</span>缩写： <input name="shortName" ng-model="editForm.shortName" required class="form-control" placeholder="缩写">
						</div>
					</div>
					<div class="row top">		
						<div class="col-sm-4">
							&nbsp;&nbsp;&nbsp;&nbsp;城市： <select name="cityId" ui-select2="{width:'150px', allowClear:'true'}"  ng-model="editForm.cityId" class="select2" data-placeholder="城市">								<option value=""></option>
								<option ng-repeat="city in cityList" value="{{city.id}}">{{city.name}}</option>
							</select>
						</div>
						<div class="col-sm-4">
							&nbsp;&nbsp;&nbsp;&nbsp;地址： <input name="addr" ng-model="editForm.addr" class="form-control" placeholder="地址">
						</div>
						<div class="col-sm-4">
							&nbsp;&nbsp;描述： <input name="descr" ng-model="editForm.descr" class="form-control" placeholder="描述">
						</div>					
					</div>
					<div class="row top">
						<div class="col-sm-4">						
							联系人： <input name="linkMan" ng-model="editForm.linkMan" class="form-control" placeholder="联系人">
						</div>
						<div class="col-sm-4">						
							&nbsp;&nbsp;&nbsp;&nbsp;电话： <input name="phone" ng-model="editForm.phone" class="form-control" placeholder="电话">
						</div>
						<div class="col-sm-4">						
							&nbsp;&nbsp;传真： <input name="fax" ng-model="editForm.fax" class="form-control" placeholder="传真">
						</div>
					</div>
					<div class="row top">
						<div class="col-sm-4">						
							&nbsp;&nbsp;&nbsp;&nbsp;邮箱： <input name="email" ng-model="editForm.email" class="form-control" placeholder="邮件">
						</div>				
						<div class="col-sm-4">
							&nbsp;&nbsp;&nbsp;&nbsp;邮编： <input name="postCd" ng-model="editForm.postCd" class="form-control" placeholder="邮编">
						</div>
						<div class="col-sm-4">						
							<span class="spancss">*</span>状态： <select name="st" ng-required="true" ui-select2="{width:'150px', allowClear:'true'}"  ng-model="editForm.st" class="select2" data-placeholder="状态">								
								<option ng-repeat="st in stList" value="{{st.id}}">{{st.lb}}</option>
							</select>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<div class="modal-footer">
		<button type="button" data-dismiss="modal" class="btn btn-default">关闭</button>
		<button ng-click="onSaveEditForm()" ng-disabled="editFormForm.$invalid" class="btn btn-default">提交</button>
	</div>
</div>
<div id="importFormModal" class="modal" tabindex="-1" data-width="400px" style="display: none;">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h4 class="modal-title">导入</h4>
	</div>
	<div class="modal-body">
		<div class="row">
			<div class="col-md-12">
				<form name="importFormForm" action="{{importForm.importUrl}}" target="_blank" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
					<div class="form-group">
						<div class="col-sm-8">
						<input name="importUrl" id="importUrl" ng-required="true" ng-model="importForm.importUrl" class="form-control" placeholder="导入" style="display: none;">
						</div>
					</div>

					<div class="form-group">
						<label for="file" class="col-sm-3 control-label">文件</label>
						<div style="float: left;margin-right: 10px;">
							<input type="file" name="file" class="form-control">
						</div>
						<div style="float: left;" >
								<button ng-click="onExportTemplate()" type="button" class="btn btn-success" style="height: 30px;padding: 4px 6px;">下载模板</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<div class="modal-footer">
		<button type="button" data-dismiss="modal" class="btn btn-default">关闭</button>
		<button type="button" ng-disabled="importFormForm.$invalid" ng-click="onImport()" class="btn btn-primary">导入</button>
	</div>
</div>
<div class="contextMenu" id="menu" style="margin-bottom: 10px">
	<ul>
		<li id="find" ng-click="onOpenQueryFormModal()">
		 <img src=""/> 
		&nbsp;查询&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		<li id="refresh" ng-click="refresh()">
		 <img src=""/> 
		&nbsp;刷新&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		<shiro:hasPermission name="sys:client:add">
		<li id="save" ng-click="onOpenEditFormModal('add')">
		 <img src=""/> 
		&nbsp;增加&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		</shiro:hasPermission>
		<shiro:hasPermission name="sys:client:del">
		<li id="del" ng-click="onOpenDelFormModal()">
		 <img src=""/> 
		&nbsp;停用&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		</shiro:hasPermission>
		<shiro:hasPermission name="sys:client:upd">
		<li id="edit" ng-click="onOpenEditFormModal('upd')">
		 <img src=""/> 
		&nbsp;编辑&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		</shiro:hasPermission>
	</ul>
</div>
<%@ include file="/WEB-INF/layouts/global_res_footer.jsp"%>
<script type="text/javascript" src="${ctx}/res_oms/sys/client.js"></script>
<script type="text/javascript" src="${ctx}/res_oms/jquery.contextmenu.r2.js"></script>
</html>
